package com.sky.business.enums;

import java.util.Objects;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 账户变动类型
 */
@Getter
@AllArgsConstructor
public enum AccountOperateType {

	/**
	 * 上课划卡
	 */
	COURSE_DECREASE(1, "上课划卡"),

	/**
	 * 课包充值
	 */
	PACKAGE_INCREASE(2, "课包充值"),

	/**
	 * 账户变动
	 */
	ACCOUNT_CHANGE(3, "账户变动");

	private final Integer type;

	private final String description;

	/**
	 * 判断类型是否存在
	 *
	 * @param operateType
	 * @return
	 */
	public static boolean existsType(Integer operateType) {
		if (Objects.isNull(operateType)) {
			return Boolean.FALSE;
		}

		for (AccountOperateType type : AccountOperateType.values()) {
			if (operateType.equals(type.getType())) {
				return Boolean.TRUE;
			}
		}
		return Boolean.FALSE;
	}
}
